load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "infosync",
    srcs = [
        "error.go",
        "info.go",
        "label_manager.go",
        "mock_info.go",
        "placement_manager.go",
        "region.go",
        "resource_manager_client.go",
        "schedule_manager.go",
        "tiflash_manager.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/domain/infosync",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/config",
        "//pkg/ddl/label",
        "//pkg/ddl/placement",
        "//pkg/ddl/util",
        "//pkg/domain/resourcegroup",
        "//pkg/errno",
        "//pkg/kv",
        "//pkg/metrics",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/sessionctx/binloginfo",
        "//pkg/sessionctx/variable",
        "//pkg/store/helper",
        "//pkg/tablecodec",
        "//pkg/util",
        "//pkg/util/codec",
        "//pkg/util/dbterror",
        "//pkg/util/engine",
        "//pkg/util/hack",
        "//pkg/util/logutil",
        "//pkg/util/syncutil",
        "//pkg/util/versioninfo",
        "@com_github_golang_protobuf//proto",
        "@com_github_gorilla_mux//:mux",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_pingcap_kvproto//pkg/meta_storagepb",
        "@com_github_pingcap_kvproto//pkg/resource_manager",
        "@com_github_pingcap_log//:log",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_pd_client//:client",
        "@com_github_tikv_pd_client//http",
        "@io_etcd_go_etcd_client_v3//:client",
        "@io_etcd_go_etcd_client_v3//concurrency",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "infosync_test",
    timeout = "short",
    srcs = ["info_test.go"],
    embed = [":infosync"],
    flaky = True,
    shard_count = 3,
    deps = [
        "//pkg/ddl/placement",
        "//pkg/ddl/util",
        "//pkg/keyspace",
        "//pkg/parser/model",
        "//pkg/testkit/testsetup",
        "//pkg/util",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//require",
        "@io_etcd_go_etcd_tests_v3//integration",
        "@org_uber_go_goleak//:goleak",
    ],
)
